package org.autumn.cas;

import java.util.ArrayList;

public class StringTest {
    static String name = "";
    static StringBuilder sb = new StringBuilder();
    static StringBuffer sbu = new StringBuffer();

    public static void main(String[] args) throws InterruptedException {
        ArrayList<Thread> threads = new ArrayList<>();
        LockCas lock = new LockCas();
        for (int i = 0; i < 10000; i++) {
            threads.add(new Thread(() -> {
                name = name + "1";
                sb.append("1");
                sbu.append("1");
            }, i + ""));
        }

        threads.forEach(Thread::start);
        for (Thread thread : threads) {
            thread.join();
        }

        System.out.println(name.length());
        System.out.println(sb.length());
        System.out.println(sbu.length());
    }
}
